<!DOCTYPE html>
<html>
<head>
    <title>接口文档</title>
    <style type="text/css">
        .bg {
            background-color: rgb(84, 127, 177);
        }

        tr {
            height: 20px;
            font-size: 12px;
        }

        .specialHeight {
            height: 40px;
        }

        pre {
            outline: 1px solid #ccc;
            padding: 5px;
            margin: 5px;
        }
    </style>
</head>
<body>
<#if exportWord?exists>
    <a href="javascript:void(0)" class="btn btn-primary" onclick="exportWord()">导出</a>
<script
        src="https://code.jquery.com/jquery-3.3.1.min.js"
        integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
        crossorigin="anonymous"></script>
<script src="../script/FileSaver.js"></script>
<script src="../script/jquery.wordexport.js"></script>
<script>
    function exportWord() {
        $("#export_word").wordExport("接口文档");
    }
</script>
</#if>
<div id="export_word">
    <div style="width:800px; margin: 0 auto">
        <h2>
            1. 说明
        </h2>
        <h4>
            1.1. 符号约定
        </h4>
        <table border="1" cellspacing="0" cellpadding="0" width="60%">
            <tr class="bg" align="center">
                <td colspan="2">符号</td>
                <td>含义</td>
            </tr>
            <tr align="center">
                <td rowspan="2">必填</td>
                <td>Y</td>
                <td>是</td>
            </tr>
            <tr align="center">
                <td>N</td>
                <td>否</td>
            </tr>

            <tr align="center">
                <td rowspan="4">参数类型</td>
                <td>query</td>
                <td>URL参数拼接</td>
            </tr>
            <tr align="center">
                <td>path</td>
                <td>替换URL中{}中的字段</td>
            </tr>
            <tr align="center">
                <td>header</td>
                <td>HTTP请求的Header中传入</td>
            </tr>
            <tr align="center">
                <td>body</td>
                <td>HTTP请求的Body中传入</td>
            </tr>
        </table>
        <br/>


        <h4>
            1.2. 文档约定
        </h4>
        <p style="font-size:60%">
            以下接口结构内容为前端推荐接口结构，因业务需求在不断更新、后台数据库业务逻辑内容等原因，最终将采用后台同事给的接口，请后台同事务必明确业务逻辑。
        </p>
        <ol start="1" style="font-size:80%">
            <li>默认字符编码charset为 <strong>UTF-8</strong> ;</li>
            <li>默认ContentType为 <strong>application/json</strong> ;</li>
            <li>权限认证信息 <strong>Authorization</strong> 在Header中进行传递;</li>
            <li>HTTP接口响应码 <strong>200</strong> 表示操作成功;</li>
            <li>HTTP接口响应码 <strong>400</strong> 表示业务异常，返回body中的message值描述了错误原因;</li>
            <li>HTTP接口响应码 <strong>401</strong> 表示权限异常，请重新登录;</li>
            <li>HTTP接口响应码 <strong>500</strong> 表示系统异常，请联系运营人员确认是否为程序BUG;</li>
            <li>如无特殊说明，时间格式默认为 <strong>yyyy-MM-dd HH:mm:ss</strong> ;</li>
        </ol>
        <br/>


        <h2>
            2. API接口说明
        </h2>
        <#list doc.tags as tag >
            <h4>
                2.${tag?counter}. ${tag.name}
            </h4>
            <#list tag.apis as api >
            <h5>
                &nbsp;&nbsp;&nbsp;&nbsp;
                2.${tag?counter}.${api?counter}. ${api.tag} [${api.summary}]
            </h5>
        <table border="1" cellspacing="1" cellpadding="0" width="100%">
            <tr>
                <td>功能说明</td>
                <td colspan="4">${api.summary}</td>
            </tr>
            <tr>
                <td>接口描述</td>
                <td colspan="4">${api.tag}</td>
            </tr>
            <tr>
                <td>API版本号</td>
                <td colspan="4">1.0</td>
            </tr>
            <tr>
                <td>API编号</td>
                <td colspan="4">${api.operationId}</td>
            </tr>
            <tr>
                <td>API接口名/URL</td>
                <td colspan="4"> ${doc.basePath}${api.path}</td>
            </tr>
            <tr>
                <td>API接口请求方式</td>
                <td colspan="4">${api.type}</td>
            </tr>
            <tr>
                <td>API接口请求类型</td>
                <td colspan="4">${api.consumes}</td>
            </tr>
            <tr>
                <td>API接口返回类型</td>
                <td colspan="4">${api.produces}</td>
            </tr>
        </table>
        <p style="font-size:70%">&nbsp;&nbsp;输入参数</p>
        <table border="1" cellspacing="0" cellpadding="0" width="100%">
            <tr class="bg" align="center">
                <td>参数名</td>
                <td>数据类型</td>
                <td>参数类型</td>
                <td>必填</td>
                <td>说明</td>
            </tr>
        <#if api.reqDtos?exists>
            <#list api.reqDtos as req >
                <tr align="center">
                    <td>${req.name}</td>
                    <#if req.type?exists>
                        <td>${req.type}</td>
                    <#else >
                        <td></td>
                    </#if>
                    <#if req.in?exists>
                        <td>${req.in}</td>
                    <#else >
                        <td></td>
                    </#if>
                    <td>
                    <#if req.required == true>
                        Y
                    <#else>
                        N
                    </#if>
                    </td>
                    <#if req.description?exists>
                        <td align="left">${req.description}</td>
                    <#else >
                        <td align="left">无</td>
                    </#if>
                </tr>
                <#if req.bodyDtoList?exists>
                    <tr class="bg">
                        <td colspan="5">${req.name}</td>
                    </tr>
                    <#list req.bodyDtoList as body >
                        <tr align="center">
                            <td>${body.field}</td>
                            <#if body.type?exists>
                                <td>${body.type}</td>
                            <#else >
                                <td></td>
                            </#if>
                            <#if body.dtoType?exists>
                                <td>${body.dtoType}</td>
                            <#else >
                                <td></td>
                            </#if>
                            <td>无</td>
                            <#if body.description?exists>
                                <td align="left">${body.description}</td>
                            <#else >
                                <td align="left"></td>
                            </#if>
                        </tr>
                    </#list>
                </#if>
            </#list>
        <#else >
        <tr align="center">
            <td>无</td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        </#if>
        </table>
        <p style="font-size:70%">&nbsp;&nbsp;返回结果</p>
        <table border="1" cellspacing="0" cellpadding="0" width="100%">
            <tr class="bg" align="center">
                <td>参数名</td>
                <td>数据类型</td>
                <td>归属类型</td>
                <td>说明</td>
            </tr>
            <#if api.resDtos?exists>
                <#list api.resDtos as res >
                <tr align="center">
                    <td>${res.field}</td>
                    <#if res.type?exists>
                        <td>${res.type}</td>
                    <#else >
                        <td>无</td>
                    </#if>
                    <#if res.dtoType?exists>
                        <td>${res.dtoType}</td>
                    <#else >
                        <td>无</td>
                    </#if>
                    <#if res.description?exists>
                        <td>${res.description}</td>
                    <#else>
                        <td>无</td>
                    </#if>
                </tr>
                    <#if res.inside?exists>
                    <tr class="bg">
                        <td colspan="5">${res.field}</td>
                    </tr>
                        <#list res.inside as ins >
                        <tr align="center">
                            <td><font color="green">${ins.field}</font></td>
                            <#if ins.type?exists>
                                <td><font color="green">${ins.type}</font></td>
                            <#else >
                                <td>无</td>
                            </#if>
                            <#if ins.dtoType?exists>
                                <td><font color="green">${ins.dtoType}</font></td>
                            <#else >
                                <td>无</td>
                            </#if>
                            <#if ins.description?exists>
                                <td><font color="green">${ins.description}</font></td>
                            <#else>
                                <td>无</td>
                            </#if>
                        </tr>
                        </#list>
                    </#if>
                </#list>
            <tr class="bg">
                <td colspan="4">示例</td>
            </tr>
            <tr class="specialHeight">
                <td colspan="4">
                    <pre> ${api.demo} </pre>
                </td>
            </tr>
            <#else>
             <tr align="center">
                 <td>ResponseEntity</td>
                 <td>HttpResponse</td>
                 <td>ResponseEntity</td>
                 <td>HttpStatus为200时，代表成功</td>
             </tr>
            </#if>
        </table>
        <br>
            </#list>
        </#list>
    </div>
</div>
</body>
</html>